<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
  <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="../../css/swiper.min.css" />
  <title>学术</title>
  <style>
		html, body {width: 100%;min-height: 100%;background: #fff;}
		.h20 {height: 0.5rem;background: #f0f0f0;}
    #header_top {
        background: #2997e4;
        padding-top: 25px;
    }
    .need_header_txt {
      padding: 0 0.75rem;
    }
    .need_header_txt h4 {
      font-size: 0.8rem;
      margin: 0.75rem 0;
      color: #333;
    }
    .need_header_txt h5 {
      font-size: 0.7rem;
      margin: 0.75rem 0;
      color: #333;
    }
    .label {
      padding: 0.75rem;
      overflow: hidden;
    }
    .label_list {
      border: 1px solid #2997e4;
      border-radius: 0.2rem;
      color: #2997e4;
      display: inline-block;
      float: left;
      font-size: 0.6rem;
      text-align: center;
      width: 22%;
      margin-right: 4%;
      height: 1.5rem;
      line-height: 1.5rem;
    }
    .label_list:nth-last-of-type(1) {
      margin-right: 0;
    }

    .cont_box ul li {
      padding: 0.75rem;
      border-bottom: 1px solid #f0f0f0;
      color: #333;
      font-size: 0.7rem;
    }
    .cont_box ul li:nth-last-of-type(1) {
      border-bottom: none;
    }
    .cont_box {
      padding-bottom: 3rem;
    }


    .ml_btns {
      position: fixed;
      bottom: 0;
      width: 100%;
    }
    .ml_btn {
      background: #f0f0f0;
      float: left;
      width: 50%;
      padding: 0.5rem 0;
      text-align: center;
      color: #666;
    }
    .ml_btn img {
      width: 0.7rem;
      display: inline-block;
      vertical-align: middle;
      margin-right: 0.4rem;
    }
    .ml_btn:nth-child(2) {
      background: #2997e4;
      color: #fff;
    }
    .need_header {
      padding-bottom: 2.5rem;
    }
    #slider1 .swiper-slide {
      height: 12rem;
    }
    .banner_bg {
      width: 100%;
      height: 12rem;
    }
    #header_top {
      position: fixed;
      top:0;
      width: 100%;
    }
    .need_header {
      padding-top: 65px;
    }
	</style>
</head>
<body>
<div id="app" v-cloak>
<header id="header_top" class="aui-bar aui-bar-nav" >

  <a class="aui-pull-left"  onclick="goback()">
      <span class="aui-iconfont aui-icon-left"></span>
  </a>
  <div class="aui-title" id="title">
  详情
</div>
    <a class="aui-pull-right" @click="openMore(id)">
        <span class="aui-iconfont aui-icon-more"></span>
    </a>
</header>
  <div class="need_header">
    <!-- <img :src="data.image" v-if="data.image != ''"> -->
    <!-- <img src="../../image/firstpage/t4@3x.png" v-else> -->
    <div class="swiper-container"  id="slider1" v-if="data.images && data.images.length > 0">
      <div class="swiper-wrapper">
        <div class="swiper-slide" v-for="item in data.images" :style="'background: url('+ item +') center/cover no-repeat'">
          <!-- <img :src="item" alt=""> -->
        </div>
      </div>
    <div class="swiper-pagination"></div>
    </div>
    <div v-else>
    <div class="banner_bg" :style="'background: url('+data.image+') center/cover no-repeat'" v-if="data.image != ''"></div>
    <div class="banner_bg" style="background: url(../../image/firstpage/t4@3x.png) center/cover no-repeat" v-else></div>

    </div>
    <div class="need_header_txt">
      <h4>{{data.title}}</h4>
      <h5>{{data.content}}</h5>
    </div>
  </div>
  <!-- <div class="h20"></div> -->
<!--
  <div class="label">
    <div class="label_list" v-for="item in data.label">{{item}}</div>
  </div>
  <div class="h20"></div>

  <div class="cont_box">
    <ul>
      <li>技术编号:{{data.number}}</li>
      <li>合作价格:面议</li>
      <li>成熟度：生试阶段</li>
      <li>来源地：{{data.place}} </li>
      <li>交付形式：{{data.delivery}} </li>
      <li>所属领域：材料科技、化学化工</li>
    </ul>
  </div> -->

  <div class="ml_btns">
    <div class="ml_btn" @click="to_chat(data.userid,data.authors,data.username)">
      <img src="../../image/zx@3x.png" alt="">咨询
    </div>
    <div class="ml_btn">
      <img src="../../image/dh@3x.png" alt="">
      <a v-if="data.mobile && data.mobile != ''" :href="'tel:' + data.mobile" style="color:inherit">电话联系</a>
      <a v-if="data.phone && data.phone != ''" :href="'tel:' + data.phone" style="color:inherit">电话联系</a>
    </div>
  </div>
</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript">

  function goback () {
    api.closeWin({name:api.pageParam.name});
  }


  //打开聊天窗口
  function to_chat(id,authors,username) {

    if(api.pageParam.title == "需求详情"){
      api.openWin({
        name: 'user_info_' + id,
        url: '../forth_frame/user_info_details_win.html',
        pageParam: {
          id: id,
          name: username,
          chat_type:'PRIVATE'
        }
      });
    }else{
      api.openWin({
        name: 'user_info_' + id,
        url: '../forth_frame/user_info_details_win.html',
        pageParam: {
          id: id,
          name: authors,
          chat_type:'PRIVATE'
        }
      });
    }


  }



apiready = function() {
  $api.byId('title').innerHTML = api.pageParam.title;

    var app = new Vue({
      el: '#app',
      data: {
        data: [],
        type: 0,
        id: 0
      },
      created: function() {
        var $_this = this;
        $_this.id = api.pageParam.id
        if(api.pageParam.title == "需求详情") {
          api.ajax({
            url: window.Url.getScienceDetail + api.pageParam.id,
            timeout: 300,
          }, function(ret, err) {
              if (ret) {
                console.log(JSON.stringify(ret))
                  // api.alert({ msg: JSON.stringify(ret) });
                  if (ret.data != null) {
                    $_this.data = ret.data

                    $_this.$nextTick(function () {

                        var mySwiper = new Swiper('#slider1',{
                          autoplay: 5000,
                          pagination : '.swiper-pagination',
                        })
                    })
                  }

              } else {
                  api.alert({ msg: JSON.stringify(err) });
              }
          })
        }else if(api.pageParam.title == "技术详情") {
          $_this.type = 0
          api.ajax({
            url: window.Url.getScientificDetail + api.pageParam.id,
            timeout: 300,
          }, function(ret, err) {
              if (ret) {
                console.log(JSON.stringify(ret))
                  // api.alert({ msg: JSON.stringify(ret) });
                  if (ret.data != null) {
                    $_this.data = ret.data
                  }

              } else {
                  api.alert({ msg: JSON.stringify(err) });
              }
          })
        }

      },
      methods: {
        openMore: function (id) {
          api.openFrame ({
                  name: 'more',
                  url: './more.html',
                  rect:{
                      x:0,
                      y:44,
                      w:'auto',
                      h:'auto'
                  },
                  pageParam: {
                    id: id,
                    type: 'kycg'
                  },
                  bounces: false,
                  delay:200
              })
        }
      }
    })
  }
</script>
</html>
